<extend name="common:commonNewerTemplate" />
<block name="main_content">
<div id="content">
	<div id="content-header">
		<div id="breadcrumb">
			<a class="tip-bottom" href="index.html"
				data-original-title="Go to Home"><i class="icon-home"></i> 首页</a> <a
				href="#">四川电信渠道经销商</a> <a class="current" href="#">四川电信渠道经销商充值申请</a>
		</div>
	</div>
	<div class="container-fluid">
		<div class="row-fluid">
			<div class="span12">
				<div class="widget-box">
					<div class="widget-title">
						<span class="icon"> <i class="icon-info-sign"></i>
						</span>
						<h5>四川电信渠道经销商充值申请</h5>
					</div>
					<div class="widget-content nopadding">
						<form novalidate="novalidate" id="basic_validate"
							name="basic_validate"  action="#" method="post"
							class="form-horizontal">
								<input type="hidden" id="dealer_recharge_id" name="dealer_recharge_id" value="{$dealer_recharge_en.dealer_recharge_id}" />
							
							<div class="control-group">
								<label class="control-label">经销商编号：</label><label
									style="text-align: left;" class="control-label">
									<span id="order_id">{$dealer_recharge_en.dealer_id}</span></label>
							</div>
							<div class="control-group">
								<label class="control-label">经销商名称：</label><label
									style="text-align: left;" class="control-label">
									<span id="order_id">{$dealer_recharge_en.dealer_name}</span></label>
							</div>
							
							<div class="control-group">
								<label class="control-label">状态:</label><label
									style="text-align: left;" class="control-label">
									<span id="order_id">{$dealer_recharge_en.recharge_status_text}</span></label>
							</div>
							
							<div class="control-group">
								<label class="control-label">变更种类：</label><label
									style="text-align: left;" class="control-label">
									<span id="order_id">{$dealer_recharge_en.amount_kind_text}</span></label>
							</div>
							
							<div class="control-group">
								<label class="control-label">变更类型：</label><label
									style="text-align: left;" class="control-label">
									<span id="order_id">{$dealer_recharge_en.amount_type_text}</span></label>
							</div>
							
							<div class="control-group">
								<label class="control-label">金额:</label><label
									style="text-align: left;" class="control-label">
									<span id="order_id">{$dealer_recharge_en.amount}</span></label>
							</div>	
							
							 
							 <div class="control-group">
								<label class="control-label">备注:</label><label
									style="text-align: left;" class="control-label">
									<span id="order_id">{$dealer_recharge_en.remark}</span></label>
							</div>
							
							 <div class="control-group">
								<label class="control-label">凭证:</label>
								<div class="controls">
								<a target="_blank" href="{$dealer_recharge_en.identify_image}"> <img src="{$dealer_recharge_en.identify_image}" alt="凭证图片" width="220px;"></img></a>
									
								</div>
							</div>
							<if condition="($dealer_recharge_en.recharge_status eq 1) OR ($dealer_recharge_en.recharge_status eq 3)">
							<div class="control-group">
								<label class="control-label">审批意见:</label>
								<div class="controls">
									<input type="text" id="remark" name="remark"/>
								</div>
							</div>
							</if>
							
							<div class="form-actions">
							<if condition="$dealer_recharge_en.recharge_status eq 1">
							<input id="btn_dealer_success" type="button" onclick="saleDepartmentSuccess('{$dealer_recharge_en.dealer_recharge_id}')"class="btn btn-success" value="销售管理部审批通过">
							<input id="btn_dealer_fail" type="button" onclick="saleDepartmentFail('{$dealer_recharge_en.dealer_recharge_id}')"class="btn btn-danger" value="销售管理部审批拒绝">							
							</if>
							<if condition="$dealer_recharge_en.recharge_status eq 3">
							<input id="btn_dealer_success" type="button" onclick="financeDepartmentSuccess('{$dealer_recharge_en.dealer_recharge_id}')"class="btn btn-success" value="财务审批通过">
							<input id="btn_dealer_fail" type="button" onclick="financeDepartmentFail('{$dealer_recharge_en.dealer_recharge_id}')"class="btn btn-danger" value="财务审批拒绝">							
							</if>
							</div>
						</form>
					</div>
				</div>
			</div>
		</div>
	</div>
</div>
</block>


<block name="js_content">
 <script>
 function  saleDepartmentSuccess(index){
	
	
	 
	 layer.open({
			type: 2,
		    title: '销售管理部审批',
	        fix: true,
	        shadeClose: true,
	        maxmin: true,
	        area: ['1000px', '500px'],
	        content: '/STDealer/saleDepartmentAudit?type=1&dealer_recharge_id='+index,
	        end: function(){
	            layer.tips('完成选择', '#photosDemo', {tips: 1})
	            window.location.reload();
	        }
	    }); 
	 
}

 function  saleDepartmentFail(index){
	
	 var remark = $('#remark').val();
		if(remark==''){
			alert("请输入审批失败原因!");
			return;
		}
	 
	 layer.open({
			type: 2,
		    title: '销售管理部审批',
	        fix: true,
	        shadeClose: true,
	        maxmin: true,
	        area: ['1000px', '500px'],
	        content: '/STDealer/saleDepartmentAudit?type=2&dealer_recharge_id='+index+"&remark="+encodeURIComponent(remark),
	        end: function(){
	            layer.tips('完成选择', '#photosDemo', {tips: 1})
	            window.location.reload();
	        }
	    }); 
	 
}
 function  financeDepartmentSuccess(index){
		
	 layer.open({
			type: 2,
		    title: '财务审批',
	        fix: true,
	        shadeClose: true,
	        maxmin: true,
	        area: ['1000px', '500px'],
	        content: '/STDealer/financeDepartmentAudit?type=3&dealer_recharge_id='+index,
	        end: function(){
	            layer.tips('完成选择', '#photosDemo', {tips: 1})
	            window.location.reload();
	        }
	    }); 
	 
}
 function  financeDepartmentFail(index){
	
	 var remark = $('#remark').val();
		if(remark==''){
			alert("请输入审批失败原因!");
			return;
		}
	 
	 layer.open({
			type: 2,
		    title: '财务审批',
	        fix: true,
	        shadeClose: true,
	        maxmin: true,
	        area: ['1000px', '500px'],
	        content: '/STDealer/financeDepartmentAudit?type=4&dealer_recharge_id='+index+"&remark="+encodeURIComponent(remark),
	        end: function(){
	            layer.tips('完成选择', '#photosDemo', {tips: 1})
	            window.location.reload();
	        }
	    }); 
	 
}
 
</script> <script src="/Public/js/layer/layer.js"  type="text/javascript"></script></block>